import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class NetInfoServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse res) 
			throws ServletException, IOException {
		res.setContentType("text/html;charset=utf-8");
		PrintWriter out = res.getWriter();
		
		out.println("<HTML><HEAD><TITLE>Response 정보 출력 Servlet</TITLE>");
		out.println("</HEAD><BODY><H3>네트워크 관련 요청 정보</H3>");
		out.println("<pre>Request Scheme : " + req.getScheme());
		out.println("Server Name : " + req.getServerName());
		out.println("Server Address : " + req.getLocalAddr());
		out.println("Server Port : " + req.getServerPort());
		out.println("Client Address : " + req.getRemoteAddr());
		out.println("Client Host : " + req.getRemoteHost());
		out.println("Client Port : " + req.getRemotePort());
		out.println("</pre>");
		out.println("</BODY></HTML>");
		out.close();
	}
}
